$(function () {
    $("form").on("submit", function () {
        //获取表单数据
        let data = $("form").serialize();
        $.ajax({
            url: "http://127.0.0.1:8080/api/login",
            type: "post",
            data: data,
        }).then(function (res) {
            console.log(res);
            if (res.code == 200) {
                localStorage.setItem("userInfo", JSON.stringify(res.data))
                setTimeout(function () {
                    location = "./index.html"
                }, 500)
            }
        })
        return false;
    })
})